package com.zxy.personage.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zxy.personage.entity.AttentionEntity;
import com.zxy.personage.service.AttentionService;
import com.zxy.common.utils.PageUtils;
import com.zxy.common.utils.R;



/**
 * 房源关注表
 *
 * @author axy
 * @email sunlightcs@gmail.com
 * @date 2022-04-23 16:51:24
 */
@RestController
@RequestMapping("personage/attention")
@CrossOrigin
public class AttentionController {
    @Autowired
    private AttentionService attentionService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = attentionService.queryPage(params);

        return R.ok().put("page", page);
    }

    @RequestMapping("/eslist")

    public R eslist(@RequestParam Map<String, Object> params){
        PageUtils page = attentionService.eslist(params);

        return R.ok().put("page", page);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{gid}")

    public R info(@PathVariable("gid") Integer gid){
		AttentionEntity attention = attentionService.getById(gid);

        return R.ok().put("attention", attention);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody AttentionEntity attention){
		attentionService.save(attention);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AttentionEntity attention){
		attentionService.updateById(attention);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] gids){
		attentionService.removeByIds(Arrays.asList(gids));

        return R.ok();
    }

}
